{% macro pagination(pageIndex=1,pageSize=5,count,api='/') %}
<div class="pagination">
    <ul class="pagination-ul">

    </ul>
</div>
<script>
    const pageIndex = parseInt('{{pageIndex}}');
    const pageSize = parseInt('{{pageSize}}');
    const count = parseInt('{{count}}');

    function isInteger(obj) {
        return obj % 1 === 0
    }
    let pageTotalNum;
    if (isInteger(count / pageSize)) {
        pageTotalNum = count / pageSize
    } else {
        pageTotalNum = Math.floor(count / pageSize) + 1
    }
    for (let i = 1; i <= pageTotalNum; i++) {
        console.log(i == pageIndex)
        let temp;
        if (i == pageIndex) {
            temp = `<li class='pageactive'>${i}</li>`
        } else {
            temp = `<li><a href="{{api}}?pageIndex=${i}">${i}</a></li>`
        }
        $('.pagination-ul').append(temp)
    }
</script>
{% endmacro %}